<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>支付设置</title>
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/jqueryPage/paging.min.js"></script>
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
<script src="../lib/jrender.min.js" type="text/javascript"></script>
<script src="../js/config.js"></script>
<script>
	$(function() {
		var account = $.cookie('user__userName');
		var md5 = $.cookie('user__code');
		$.ajax({
			type: 'POST',
			url: $.webConfig.basicUrl+'/chuyangPay/user/getUserDBChuYangKey',
			data: {
				account: account,
				md5: md5,
			},
			dataType: "json",
			success: function(data) {	
				if(data['code'] == 200) {
					console.log(data);
					$('#Merchant').val(data['data']['userMerchantNo']);
					$('#publickey').val(data['data']['userPublicKey']);
					$('#privatekey').html(data['data']['userPrivate']);
					
				} else {
					layer.alert(data['msc']);
				}
			},
			error: function(err) {
				console.log(err);
			}
		})
	})
</script>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-add">
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>商户号：</label>
		<div class="formControls col-xs-5 col-sm-6">
			<input type="text" class="input-text"  placeholder="" id="Merchant"  disabled="true"/>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>公钥：</label>
		<div class="formControls col-xs-5 col-sm-6">
			<input type="text" class="input-text"  placeholder="" id="publickey" disabled="true"/ >
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>私钥：</label>
		<div class="formControls col-xs-5 col-sm-6">
			<textarea name="" cols="" rows="" class="textarea"  placeholder="" id="privatekey" disabled="true"></textarea>
		</div>
	</div>
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input id="xiugai-btn" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;修改&nbsp;&nbsp;">
			<input id="savemes" class="btn btn-primary radius" disabled="true" type="button" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
		</div>
	</div>
	</form>
</article>
<script>
	$("#savemes").click(function(){
		account = $.cookie('user__userName');
		md5 = $.cookie('user__code');
		var userPublicKey=$("#publickey").val();
		var userPrivate=$("#privatekey").val();
		$.ajax({
		 	type:'post',
			url:$.webConfig.basicUrl+"/chuyangPay/user/updateChuYangKey" ,
			data: {
				account:account,
				md5:md5,
				userPublicKey:userPublicKey,
				userPrivate:userPrivate,
			},
			dataType: "json",
			success: function(data){
				if(data['code'] == 200) {
					layer.msg('成功!',{icon:1,time:1000});
				}
				else{
					layer.alert(data['msc']);
				}
			},
			error: function(XmlHttpRequest, textStatus, errorThrown){
				layer.msg('error!',{icon:2,time:1000});
			}
		})
	});

	$('#xiugai-btn').on('click',function(){
		$('input').removeAttr('disabled');
		$('textarea').removeAttr('disabled');
	});
</script>
</body>
</html>